#!/bin/sh
table_name=$1
connstr=$2

if [ $# -ne 2 ]
then
    echo " Param Error!" 
    echo " Usage: sh $0 table_name dbuser/dbpwd@dbsid " 
    echo " Eg:    sh $0 F_CI_CIPL_PTY_NAME_CCBS odsbdata/odsbdata@odsbptdb " 
    exit -1
fi
table_name=`echo $table_name | tr a-z A-Z`

sqlplus -s ${connstr}<<EOF
  SET   HEADING   OFF;
  SET   ECHO   OFF;
  SET   FEEDBACK   OFF;
  SET   PAGESIZE   0;
  SET   TRIMSPOOL   ON;
 select DBMS_LOB.substr(DBMS_METADATA.get_ddl('TABLE', u.table_name))
   FROM user_tables u
  where u.table_name like '${table_name}';
exit;
EOF




exit 0
